/*
               File: GXLRED
        Description: Load redundancy procedure
             Author: GeneXus C# Generator version 8_0_0-201
       Generated on: 21 de Setiembre de 2010 17:39:45.20
       Program type: Callable routine
          Main DBMS: sqlserver
*/
namespace GeneXus.Programs {
   using System;
   using System.Collections;
   using GeneXus.Utils;
   using GeneXus.Resources;
   using GeneXus.Application;
   using GeneXus.Metadata;
   using GeneXus.Reorg;
   using System.Threading;
   using GeneXus.Programs;
   using System.Web.Services;
   using com.genexus;
   using com.genexus.ui;
   using com.genexus.uifactory;
   using GeneXus.Windows;
   using System.Data;
   using System.Data.SqlClient;
   using GeneXus.Data;
   using GeneXus.Data.FAT;
   using GeneXus.Http;
   using GeneXus.Procedure;
   using GeneXus.XML;
   using GeneXus.Encryption;
   using GeneXus.Http.Client;
   public class gxlred_wrapper : GXJWin
   {
      public gxlred_wrapper( int hnd ,
                             ModelContext jContext ) : base(hnd, jContext)
      {
      }

   }

   public class gxlred : GXWinProcedure
   {
      public gxlred( int hnd ,
                     ModelContext jContext ) : base(hnd, jContext)
      {
         IsMain = true;
         context = new GxContext();
         context.DataStores.Add(new GxDataStore( new GxSqlServer(),"Default", @"Driver=sql server;uid=sa;pwd=;SERVER=ofalcon;DATABASE=PracticoTransportes;trusted_connection=no;"));
         dsDefault = context.GetDataStore("Default") ;
      }

      public gxlred( )
      {
         context = new GxContext();
         context.DataStores.Add(new GxDataStore( new GxSqlServer(),"Default", @"Driver=sql server;uid=sa;pwd=;SERVER=ofalcon;DATABASE=PracticoTransportes;trusted_connection=no;"));
         dsDefault = context.GetDataStore("Default") ;
         IsMain = true;
      }

      public gxlred( IGxContext context ) : base(-1, null)
      {
         this.context = context;
         IsMain = false;
         dsDefault = context.GetDataStore("Default") ;
      }

      public gxlred( IGxContext context ,
                     int hnd ,
                     ModelContext jContext ) : base(hnd, jContext)
      {
         this.context = context;
         IsMain = false;
         dsDefault = context.GetDataStore("Default") ;
      }

      public void execute( )
      {
         initialize();
         executePrivate();
      }

      public void executeSubmit( )
      {
         gxlred objgxlred;
         objgxlred = new gxlred();
         objgxlred.initialize();
         Thread execThread;
         execThread = new Thread(new ThreadStart( objgxlred.executePrivate ));
         execThread.Start();
      }

      void executePrivate( )
      {
         /* GeneXus formulas */
         /* Output device settings */
         this.cleanup();
      }

      public override int getOutputType( )
      {
         return GxReportUtils.OUTPUT_RVIEWER_DLL ;
      }

      protected void cleanup( )
      {
         if ( IsMain )
         {
            context.CloseConnections() ;
         }
      }

      public override void initialize( )
      {
         /* GeneXus formulas. */
         Gx_err = 0 ;
      }

      private short Gx_err ;
      private IGxDataStore dsDefault ;
   }

}
